﻿@model ScmSafetyknowledgeViewModel
@{
    Layout = null;
    ViewBag.Title = "安全知识列表";
}
<script type="text/javascript">
    $(document).ready(function () {
        $(".comsplitpage").val("@ViewBag.numPerPage");
    });
</script>
@using (Html.BeginForm("SplitPage", "ScmSafeTraining", null, FormMethod.Post, new { id = "pagerForm" }))
{
    <input type="hidden" name="pageNum" value="1" />
    <input type="hidden" name="numPerPage" value="@(ViewBag.numPerPage)" />
    <input type="hidden" name="pageType" value="@(ViewBag.type)" />
    @Html.Hidden("TheSafetyKnowledge.Sk_Title", Model.TheSafetyKnowledge == null ? "" : Model.TheSafetyKnowledge.Sk_Title)    
    @Html.Hidden("TheSafetyKnowledge.Sk_PublishOrgName", Model.TheSafetyKnowledge == null ? "" : Model.TheSafetyKnowledge.Sk_PublishOrgName)
    @Html.Hidden("PublishBeginTime", Model.PublishBeginTime)
    @Html.Hidden("PublishEndTime", Model.PublishEndTime)
}

<div class="pageHeader">
    @using (Html.BeginForm("SafeTrainningSearch", "ScmSafeTraining", null, FormMethod.Post, new { id = "search", onsubmit = "return navTabSearch(this);" }))
    {
        <input type="hidden" name="pageNum" value="1" />
        <input type="hidden" name="numPerPage" value="@(ViewBag.numPerPage)" />
        <input type="hidden" name="pageType" value="@(ViewBag.type)" />
        <div class="searchBar">
            <table class="searchContent">
                <tr>
                    <td>@(ViewBag.typeName)：@Html.TextBoxFor(model => model.TheSafetyKnowledge.Sk_Title)
                    </td>
                    <td>发布机构：@Html.TextBoxFor(model => model.TheSafetyKnowledge.Sk_PublishOrgName)
                    </td>
                    <td class="dateRange">发布日期：
                      @Html.TextBoxFor(model => model.PublishBeginTime, new { @class = "date" })
                        <span class="limit">-</span>
                        @Html.TextBoxFor(model => model.PublishEndTime, new { @class = "date" })
                    </td>
                    <td>
                        <button type="submit" class="btn btn-success btn-xs">搜索</button>
                    </td>
                </tr>
            </table>
        </div>
    }
</div>
<div class="pageContent">
    <div class="panelBar">
        <ul class="toolBar">
            <li>
                @Html.PermissionButton("SafetyConstruction.SafeTrainningList?type=1.Create", "Plm_SafetyConst_ScmSafeTraining_SafeTrainningAdd",
                    Url.Action("SafeTrainningAdd", "ScmSafeTraining", new { type = ViewBag.type, target = "add" }),
                    "添加",
                    new Dictionary<string, object>
                    {
                        {"class","add"},{"rel","zsk_add"} ,{"mask","true"},{"target","dialog"},{"width","900"},{"height","600"}
                    })
            </li>
            <li>
                @Html.PermissionButton("SafeTraining.List.Delete", "zsk_delete_Id",
                             Url.Action("SafeTrainningMultiDelete", "ScmSafeTraining", new { type = ViewBag.type }),
                    "删除",
                    new Dictionary<string, object>
                    {
                        {"class","delete"},{"rel","ids"} ,{"title","确定要删除这些记录吗?"},{"target","selectedTodo"},{"postType","string"}
                    })
            </li>
            <li>
                @Html.PermissionButton("SafetyConstruction.SafeTrainningList?type=1.Edit", "zsk_edit_Id",
                    Url.Action("SafeTrainningAdd", "ScmSafeTraining", new { type = ViewBag.type, target = "edit", skId = "{tr_id}" }),
                    "修改",
                    new Dictionary<string, object>
                    {
                        {"class","edit"},{"rel","zsk_edit"} ,{"mask","true"},{"target","dialog"},{"width","900"},{"height","600"},{"warn","请选择一条信息!"}
                    })
            </li>
            <li>
                @Html.PermissionButton("SafeTraining.List.Detail", "zsk_detail_Id",
                    Url.Action("Detail", "ScmSafeTraining", new { type = ViewBag.type, id = "{tr_id}" }),
                    "查看",
                    new Dictionary<string, object>
                    {
                        {"class","detail"},{"rel","zsk_detail"} ,{"mask","true"},{"target","dialog"},{"width","820"},{"height","610"},{"warn","请选择一条信息!"}
                    })
            </li>
            @*<li><a class="delete" href="@Url.Action("SafeTrainningMultiDelete", "ScmSafeTraining", new { ids = "{tr_id}" })"  title="确定要删除该条记录吗?" target="ajaxTodo" ><span>删除</span></a></li>*@
        </ul>
    </div>
    <table class="table" width="100%" layouth="137">
        <thead>
            <tr>
                <th width="22">
                    <input type="checkbox" group="ids" class="checkboxCtrl">
                </th>
                <th width="50" style="text-align: center">序号</th>
                <th style="text-align: center">@(ViewBag.typeName)</th>
                <th style="text-align: center">发布机构</th>
                <th style="text-align: center">发布日期</th>
            </tr>
        </thead>
        <tbody>
            @{ int num = (ViewBag.pageNum - 1) * ViewBag.numPerPage;}
            @foreach (var item in Model.TheSafetyKnowledgeList)
            {
                num += 1;
                <tr style="text-align:center" target="tr_id" rel="@item.Sk_ID">
                    <td style="text-align: center">
                        <input name="ids" value="@item.Sk_ID" type="checkbox">
                    </td>
                    <td style="text-align: center">@num</td>
                    <td style="text-align: center"><a title="查看@(ViewBag.typeName)" href="@Url.Action("Detail", "ScmSafeTraining", new { id = item.Sk_ID, type = ViewBag.type })" mask="true" target="dialog" width="820" height="610">@item.Sk_Title</a></td>
                    <td style="text-align: center">@item.Sk_PublishOrgName</td>
                    <td style="text-align: center">@item.Sk_CreateTime.ToString("yyyy-MM-dd")</td>
                </tr>

            }
        </tbody>
    </table>
    <div class="panelBar">
        <div class="pagination" targettype="navTab" totalcount="@(ViewBag.totalcount)" numperpage="@(ViewBag.numPerPage)" pagenumshown="10" currentpage="@(ViewBag.pageNum)"></div>
        <div class="pages">
            <span>显示</span>
            <select class="comsplitpage"  name="numPerPage" onchange="navTabPageBreak({numPerPage:this.value})">
                <option value="10">10</option>
                <option value="20">20</option>
                <option value="50">50</option>
            </select>
            <span>条，共@(ViewBag.pagenumshown)页,@(ViewBag.totalcount)条</span>
        </div>
    </div>
</div>

